﻿using System;
using System.Collections.Generic;
using System.Text;
using EmbeddedSharp.Core;
using Zove.Runtime.Core.Expression;

namespace Zove.Runtime.Core
{
    public class ZoveUnaryFunctionTranslator : UnaryFunctionTranslator
    {
        public ZoveUnaryFunctionTranslator(
            IFunctionManager funMgr, string subject)
            : base(funMgr, subject)
        {
        }

        public override object Visit(IdentifierNode node) {
            if (subject == node.Value) {
                return "x";
            }

            if(node is FactorNode)
            {
                FactorNode fn = node as FactorNode;
                return fn.Factor.Value;
            }

            return node.Value;
        }
    }
}
